<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var num = prompt('请输入一个0-255之间的整数') - 0
        var reg = /^(\d|\d{2}|1\d{2}|2[0-4]\d|25[[0-5]])$/
        if(reg.test(num)){
            alert('妙哉')
        }else{
            alert('请输入一个0-255之间的整数')
        }
    </script>
</body>
</html>